package com.itheima.day02static;

/*
* 6、【编号：1007】结合继承的思想，分析下列需求并实现
定义项目经理类Manager 【属性：姓名 工号 工资 奖金】【
* 行为：工作work】定义程序员类Coder【属性：姓名 工号
* 工资】【行为：工作work】要求：通过有参构造创建两个
* 类的对象，并调用各自的work方法运行结果：
姓名为:张三,工号为:9527,工资为:10000.0,的程序员正在编写代码
姓名为:李四,工号为:9528,工资为:15000.0,奖金为:2000.0,的项目经理正在管理程序员写代码
* */
public class Demo6 {
    public static void main(String[] args) {
        YuanGong manager = new Manager("李四",
                9528, 15000.0, 2000.0);
        manager.work();
        YuanGong coder = new Coder("张三", 9527,
                10000.0);
        coder.work();
    }
}

abstract class YuanGong {
    private String name;
    private Integer id;
    private double salary;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public YuanGong() {
    }

    public YuanGong(String name, Integer id, double salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }

    public abstract void work();
}

class Manager extends YuanGong {
    private double jiangjin;

    public Manager() {
    }

    public Manager(String name, Integer id, double salary, double jiangjin) {
        super(name, id, salary);
        this.jiangjin = jiangjin;
    }

    public double getJiangjin() {
        return jiangjin;
    }

    public void setJiangjin(double jiangjin) {
        this.jiangjin = jiangjin;
    }

    @Override
    public void work() {
        System.out.println("姓名为:" + getName() + "工号为:" + getId() + "工资为:" + getSalary() +
                "奖金为:" + getJiangjin() + "的项目经理正在管理程序员写代码");
    }
}

class Coder extends YuanGong {
    public Coder() {
    }

    public Coder(String name, Integer id, double salary) {
        super(name, id, salary);
    }

    @Override
    public void work() {
        System.out.println("姓名为:" + getName() + "工号为:" + getId() + "工资为:" + getSalary() + "的程序员正在编写代码");
    }
}